package org.exam.config;

import org.springframework.web.context.WebApplicationContext;
import org.springframework.web.context.support.AnnotationConfigWebApplicationContext;
import org.springframework.web.servlet.support.AbstractDispatcherServletInitializer;

public class serveletContainerInitConfig extends AbstractDispatcherServletInitializer {

    //创建springMvc容器
    @Override
    protected WebApplicationContext createServletApplicationContext() {

        AnnotationConfigWebApplicationContext webApplicationContext = new AnnotationConfigWebApplicationContext();
        webApplicationContext.register(springMvcConfig.class);
        return webApplicationContext;
    }

    @Override
    protected String[] getServletMappings() {
        return new String[]{"/"};
    }


    //创建spring容器
    @Override
    protected WebApplicationContext createRootApplicationContext() {
        return null;
    }
}
